package 创建的方式;

public class 博客 {
    public static void main(String[] args) {
        int num = 10_0000_0000;
        long start = System.currentTimeMillis();
        for (int i = 0; i < 100; i++) {
            Thread t = new Thread(new Runnable() {
                @Override
                public void run() {
                    for (int j = 0; j < 10_0000_0000; j++) {
                        
                    }
                }
            });
        }
        while(Thread.activeCount() > 1){//activeCount返回活跃线程数
            Thread.yield();//main就让步（从运行态转为就绪态）
        }
        long end = System.currentTimeMillis();
        System.out.printf("线程执行时间：%s",end - start);
    }
}
